home *** CD-ROM | disk | FTP | other *** search
- /* ==============
- * V3DAgentDoc.hh
- * ==============
- *
- * Implemented by V3DAgentDoc.cc
- */
-
- #include <Menus.h>
-
- #include "PedWindow.hh"
- #include "PedFSRef.hh"
- #include "V3DDocModel.hh"
- #include "V3DAgentDoc.hh"
- #include "V3DPanePort.hh"
-
- V3DAgentDoc::V3DAgentDoc(PedTask *inParent, V3DDocModel *inDocument)
- : PedAgentDoc(inParent), mDocument(inDocument)
- {
- inDocument->retain();
- }
-
- V3DAgentDoc::~V3DAgentDoc()
- {
- if (mDocument) {
- mDocument->release();
- }
- }
-
- PedDocument *
- V3DAgentDoc::Document()
- {
- return mDocument;
- }
-
- void
- V3DAgentDoc::InitWindow()
- {
- if (!mWindow && mDocument) {
- mWindow = new PedWindow(this);
- mDocument->Load();
-
- Rect rect = {18, 0, 18+2*4+11*25+16, 2*4+6*80+16};
- short mbarHeight = ::GetMBarHeight();
- short vMargin = (qd.screenBits.bounds.bottom - rect.bottom) - mbarHeight;
- short hMargin = (qd.screenBits.bounds.right - rect.right);
- ::OffsetRect(&rect, hMargin / 2, mbarHeight + vMargin / 3);
-
- // Set the bounds before creating the pane, because things aren't
- // perfect yet and the pane will be sized to the old bounds.
- mWindow->SetBounds(rect);
- if (mDocument->File()) {
- mWindow->SetTitle(mDocument->File()->FSS().name);
- }
-
- C3DModel *model = mDocument->Model();
- if (model) {
- V3DPanePort *pane = new V3DPanePort(*mWindow, *model);
- mWindow->SetPane(pane);
- }
-
- //mAnimateChore = new PedChoreGeneric(&Animate3DFunc, this);
- //mAnimateChore->retain();
- //Ped1AppProcess::Me().MainModule().InstallIdleChore(mAnimateChore);
- }
- }
-
- void
- V3DAgentDoc::ProcessKey(EventRecord &inEvent)
- {
- char c = inEvent.message & charCodeMask;
- short code = (inEvent.message & keyCodeMask) >> 8;
- ProcessKey(c, code);
- }
-
- void
- V3DAgentDoc::ProcessKey(char inChar, short inCode)
- {
- char c = inChar;
-
- mWindow->Pane()->DoKey(c);
- }
-
-